#include <bits/stdc++.h>
using namespace std;

int cmpfunc(const void *a, const void *b) {
	return (*(int *)a - * (int *)b);
}

int main(void) {
	int index[10005] = {0};
	int count = 0;
	int num[105] = {0};
	int flag = 0;
	cin >> count;
	for (int i = 0; i < count; i++) {
		cin >> num[i];
		index[num[i]] = 1;
	}
	qsort(num, count, sizeof(int), cmpfunc);
	for (int i = count - 1; i > 1; i--) {
		for (int j = 0; j < i; j++) {
			if (index[num[i] - num[j]] == 1 && num[i] - num[j] != num[j]) {
				flag++;
				break;
			}

		}
	}
	cout << flag << endl;
	return 0;
}